package patrol.mobile.com.mobilepatrol.widget.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import patrol.mobile.com.mobilepatrol.R;


/**
 * Created by shjshi on 2017/8/15.
 */

public class EditDialog extends Dialog {
    private String title;
    private EditText et_rc;
    private EditText et_sp;
    private EditText et_ep;
    private TextView tv_cancel;
    private TextView tv_sure;
    private SureListener mListener;
    String rc;
    String sp;
    String ep;
    public EditDialog(Context context, int themeResId) {
        super(context, themeResId);

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_dialog_apple);
        initView();
        initListener();
    }

    private void initListener() {
        tv_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EditDialog.this.dismiss();
            }
        });
        tv_sure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                rc = et_rc.getText().toString().trim();
                sp = et_sp.getText().toString().trim();
                ep = et_ep.getText().toString().trim();
                mListener.onSure(rc,sp,ep);
            }
        });
    }

    public void setmListener(SureListener mListener) {
        this.mListener = mListener;
    }



    private void initView() {
        et_rc = ((EditText) findViewById(R.id.et_rc));
        et_sp = ((EditText) findViewById(R.id.et_sp));
        et_ep = ((EditText) findViewById(R.id.et_ep));
        tv_cancel = ((TextView) findViewById(R.id.tv_cancel));
        tv_sure = ((TextView) findViewById(R.id.tv_sure));
    }
    public interface SureListener{
        void onSure(String rc,String sp,String ep);
    }
}
